package com.xiaoye;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class updateStudents {
    public static void main(String[] args) {
        String url = "jdbc:mysql://47.93.162.187:3306/digitaltwin"; // 数据库连接URL
        String username = "root"; // 数据库用户名
        String password1 = "ZXCzxc1@"; // 数据库密码

        try (Connection conn = DriverManager.getConnection(url, username, password1)) {
            // 更新数据库中的记录
            String updateSql = "UPDATE student SET baopoFlag = 'False', neiyaFlag = 'False', waiyaFlag = 'False'";
            PreparedStatement updateStatement = conn.prepareStatement(updateSql);
            int rowsAffected = updateStatement.executeUpdate();

            // 显示更新的行数
            System.out.println(rowsAffected + " 行记录更新成功！");

            // 关闭连接
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
